
<!DOCTYPE html>
<html lang="zh-Hans" class="loading">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>前端代码规范-CSS篇 - 默默默默燃</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="TriDiamond Obsidian,"> 
    <meta name="description" content="一枚前端搬砖队队员的记录册,tab键用（必须）四个空格代替　　因为在不同系统的编辑工具对tab解析不一样，windows下的tab键是占四个空格的位置，而在linux下会变成占八个空格的位置（除非你自己设定了tab键所占的位置,"> 
    <meta name="author" content="张白告丶"> 
    <link rel="alternative" href="atom.xml" title="默默默默燃" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    <link href="https://fonts.loli.net/css?family=Roboto+Mono|Rubik&display=swap" rel="stylesheet">
    
<link rel="stylesheet" href="//at.alicdn.com/t/font_1429596_nzgqgvnmkjb.css">

    
<link rel="stylesheet" href="//cdn.bootcss.com/animate.css/3.7.2/animate.min.css">

    
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css">

    
<link rel="stylesheet" href="//cdn.bootcss.com/codemirror/5.48.4/codemirror.min.css">

    
<link rel="stylesheet" href="//cdn.bootcss.com/codemirror/5.48.4/theme/dracula.css">

    
<link rel="stylesheet" href="/css/obsidian.css">

    
<link rel="stylesheet" href="/css/ball-atom.min.css">

<meta name="generator" content="Hexo 4.2.0"></head>


<body class="loading">
    <div class="loader">
        <div class="la-ball-atom la-2x">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
    <span id="config-title" style="display:none">默默默默燃</span>
    <div id="loader"></div>
    <div id="single">
    <div class="scrollbar gradient-bg-rev"></div>
<div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <div class="navigation animated fadeIn fast delay-1s">
        <img id="home-icon" class="icon-home" src="/img/favicon.png" alt="" data-url="https://zhanghao-web.github.io">
        <div id="play-icon" title="Play/Pause" class="iconfont icon-play"></div>
        <h3 class="subtitle">前端代码规范-CSS篇</h3>
        <div class="social">
            <!--        <div class="like-icon">-->
            <!--            <a href="javascript:;" class="likeThis active"><span class="icon-like"></span><span class="count">76</span></a>-->
            <!--        </div>-->
            <div>
                <div class="share">
                    
                        <a href="javascript:;" class="iconfont icon-share1"></a>
                        <div class="share-component-cc" data-disabled="facebook,douban,linkedin,diandian,tencent,google"></div>
                    
                </div>
            </div>
        </div>
    </div>
</div>

    <div class="section">
        <div class=article-header-wrapper>
    <div class="article-header">
        <div class="article-cover animated fadeIn" style="
            animation-delay: 600ms;
            animation-duration: 1.2s;
            background-image: 
                radial-gradient(ellipse closest-side, rgba(0, 0, 0, 0.65), #100e17),
                url(/img/cover.jpg) ">
        </div>
        <div class="else">
            <p class="animated fadeInDown">
                
                <a href="/categories/Standard"><b>「
                    </b>STANDARD<b> 」</b></a>
                
                April 18, 2018
            </p>
            <h3 class="post-title animated fadeInDown"><a href="/2018/04/18/Record/%E5%89%8D%E7%AB%AF%E4%BB%A3%E7%A0%81%E8%A7%84%E8%8C%83-CSS%E7%AF%87/" title="前端代码规范-CSS篇" class="">前端代码规范-CSS篇</a>
            </h3>
            
            <p class="post-count animated fadeInDown">
                
                <span>
                    <b class="iconfont icon-text2"></b> <i>Words count</i>
                    13k
                </span>
                
                
                <span>
                    <b class="iconfont icon-timer__s"></b> <i>Reading time</i>
                    12 mins.
                </span>
                
                
                
                <span id="busuanzi_container_page_pv">
                    <b class="iconfont icon-read"></b> <i>Read count</i>
                    <span id="busuanzi_value_page_pv">0</span>
                </span>
                
            </p>
            
            
            <ul class="animated fadeInDown post-tags-list" itemprop="keywords"><li class="animated fadeInDown post-tags-list-item"><a class="animated fadeInDown post-tags-list-link" href="/tags/Record/" rel="tag">Record</a></li></ul>
            
        </div>
    </div>
</div>

<div class="screen-gradient-after">
    <div class="screen-gradient-content">
        <div class="screen-gradient-content-inside">
            <div class="bold-underline-links screen-gradient-sponsor">
                <p>
                    <span class="animated fadeIn delay-1s"></span>
                </p>
            </div>
        </div>
    </div>
</div>

<div class="article">
    <div class='main'>
        <div class="content markdown animated fadeIn">
            <h2 id="tab键用（必须）四个空格代替"><a href="#tab键用（必须）四个空格代替" class="headerlink" title="tab键用（必须）四个空格代替"></a>tab键用（必须）四个空格代替</h2><p>　　因为在不同系统的编辑工具对tab解析不一样，windows下的tab键是占四个空格的位置，而在linux下会变成占八个空格的位置（除非你自己设定了tab键所占的位置长度）。</p>
<h2 id="每个样式属性后（必须）加-“-”"><a href="#每个样式属性后（必须）加-“-”" class="headerlink" title="每个样式属性后（必须）加 “;”"></a>每个样式属性后（必须）加 “;”</h2><pre><code>方便压缩工具&quot;断句&quot;。
</code></pre><h2 id="Class命名中（禁止）出现大写字母，（必须）采用”-“对class中的字母分隔，如："><a href="#Class命名中（禁止）出现大写字母，（必须）采用”-“对class中的字母分隔，如：" class="headerlink" title="Class命名中（禁止）出现大写字母，（必须）采用” - “对class中的字母分隔，如："></a>Class命名中（禁止）出现大写字母，（必须）采用” - “对class中的字母分隔，如：</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"> <span class="comment">/* 正确的写法 */</span></span><br><span class="line"> <span class="selector-class">.hotel-title</span> &#123;</span><br><span class="line">     <span class="attribute">font-weight</span>: bold;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="comment">/* 不推荐的写法 */</span></span><br><span class="line"> <span class="selector-class">.hotelTitle</span> &#123;</span><br><span class="line">     <span class="attribute">font-weight</span>: bold;</span><br><span class="line"> &#125;</span><br><span class="line">```    </span><br><span class="line"></span><br><span class="line">* 用"<span class="selector-tag">-</span>"隔开比使用驼峰是更加清晰。</span><br><span class="line">* 产品线<span class="selector-tag">-</span>产品<span class="selector-tag">-</span>模块<span class="selector-tag">-</span>子模块，命名的时候也可以使用这种方式（<span class="keyword">@Artwl</span>）</span><br><span class="line"></span><br><span class="line">## 空格的使用，以下规则（必须）执行：</span><br><span class="line">```css</span><br><span class="line">.hotel-content &#123;</span><br><span class="line">     <span class="selector-tag">font-weight</span>: <span class="selector-tag">bold</span>;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>选择器与 { 之前（必须）要有空格</li>
<li>属性名的 : 后（必须）要有空格</li>
<li>属性名的 : 前（禁止）加空格</li>
</ul>
<h2 id="多选择器规则之间（必须）换行"><a href="#多选择器规则之间（必须）换行" class="headerlink" title="多选择器规则之间（必须）换行"></a>多选择器规则之间（必须）换行</h2><p>当样式针对多个选择器时每个选择器占一行</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* 推荐的写法 */</span></span><br><span class="line"><span class="selector-tag">a</span><span class="selector-class">.btn</span>,</span><br><span class="line"><span class="selector-tag">input</span><span class="selector-class">.btn</span>,</span><br><span class="line"><span class="selector-tag">input</span><span class="selector-attr">[type=<span class="string">"button"</span>]</span> &#123;</span><br><span class="line">    ......</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<a id="more"></a>
<h2 id="（禁止）将样式写为单行-如"><a href="#（禁止）将样式写为单行-如" class="headerlink" title="（禁止）将样式写为单行, 如"></a>（禁止）将样式写为单行, 如</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.hotel-content</span> &#123;<span class="attribute">margin</span>: <span class="number">10px</span>; <span class="attribute">background-color</span>: <span class="number">#efefef</span>;&#125;</span><br></pre></td></tr></table></figure>
<p>单行显示不好注释，不好备注，这应该是压缩工具的活儿~</p>
<h2 id="（禁止）向-0-后添加单位-如："><a href="#（禁止）向-0-后添加单位-如：" class="headerlink" title="（禁止）向 0 后添加单位, 如："></a>（禁止）向 0 后添加单位, 如：</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.obj</span> &#123;</span><br><span class="line">    <span class="attribute">left</span>: <span class="number">0px</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="（禁止）使用css原生import"><a href="#（禁止）使用css原生import" class="headerlink" title="（禁止）使用css原生import"></a>（禁止）使用css原生import</h2><p>使用css原生import有很多弊端，比如会增加请求数等….</p>
<h2 id="（推荐）属性的书写顺序-举个例子"><a href="#（推荐）属性的书写顺序-举个例子" class="headerlink" title="（推荐）属性的书写顺序, 举个例子:"></a>（推荐）属性的书写顺序, 举个例子:</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.hotel-content</span> &#123;</span><br><span class="line">     <span class="comment">/* 定位 */</span></span><br><span class="line">     <span class="attribute">display</span>: block;</span><br><span class="line">     <span class="attribute">position</span>: absolute;</span><br><span class="line">     <span class="attribute">left</span>: <span class="number">0</span>;</span><br><span class="line">     <span class="attribute">top</span>: <span class="number">0</span>;</span><br><span class="line">     <span class="comment">/* 盒模型 */</span></span><br><span class="line">     <span class="attribute">width</span>: <span class="number">50px</span>;</span><br><span class="line">     <span class="attribute">height</span>: <span class="number">50px</span>;</span><br><span class="line">     <span class="attribute">margin</span>: <span class="number">10px</span>;</span><br><span class="line">     <span class="attribute">border</span>: <span class="number">1px</span> solid black;</span><br><span class="line">     / *其他* /</span><br><span class="line">     <span class="selector-tag">color</span>: <span class="selector-id">#efefef</span>;</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>定位相关, 常见的有：display position left top float 等</li>
<li>盒模型相关, 常见的有：width height margin padding border 等</li>
<li>其他属性</li>
</ul>
<blockquote>
<p>按照这样的顺序书写可见提升浏览器渲染dom的性能<br>　简单举个例子，网页中的图片，如果没有设置width和height，在图片载入之前，他所占的空间为0，但是当他加载完毕之后，那块为0的空间突然被撑开了，这样会导致，他下面的元素重新排列和渲染，造成重绘（repaint）和回流（reflow）。我们在写css的时候，把元素的定位放在前头，首先让浏览器知道该元素是在文本流内还是外，具体在页面的哪个部位，接着让浏览器知道他们的宽度和高度，border等这些占用空间的属性，其他的属性都是在这个固定的区域内渲染的，差不多就是这个意思吧~(@frec)</p>
</blockquote>
<p> 推荐文章： <a href="https://css-tricks.com/poll-results-how-do-you-order-your-css-properties/" target="_blank" rel="noopener">https://css-tricks.com/poll-results-how-do-you-order-your-css-properties/</a><br>          <a href="http://www.mozilla.org/css/base/content.css" target="_blank" rel="noopener">http://www.mozilla.org/css/base/content.css</a></p>
<h2 id="小图片（必须）sprite-合并"><a href="#小图片（必须）sprite-合并" class="headerlink" title="小图片（必须）sprite 合并"></a>小图片（必须）sprite 合并</h2><p>推荐文章：<a href="http://www.alloyteam.com/2012/09/update-ispriter-smart-merging-css-sprite/" target="_blank" rel="noopener">NodeJs智能合并CSS精灵图工具iSpriter</a></p>
<h2 id="推荐）当编写针对特定html结构的样式时，使用元素名-类名"><a href="#推荐）当编写针对特定html结构的样式时，使用元素名-类名" class="headerlink" title="(推荐）当编写针对特定html结构的样式时，使用元素名 + 类名"></a>(推荐）当编写针对特定html结构的样式时，使用元素名 + 类名</h2><p>/<em> 所有的nav都是针对ul编写的 </em>/<br><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">ul</span><span class="selector-class">.nav</span> &#123;</span><br><span class="line">    ......</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><br>“.a div”和”.a div.b”，为什么后者好？如果需求有所变化，在”.a”下有多加了一个div，试问，开始的样式是不是会影响后来的div啊~</p>
<h2 id="推荐）IE-Hack-List"><a href="#推荐）IE-Hack-List" class="headerlink" title="(推荐）IE Hack List"></a>(推荐）IE Hack List</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/* 针对ie的hack */</span></span><br><span class="line"><span class="selector-tag">selector</span> &#123;</span><br><span class="line">    <span class="attribute">property</span>: value;     <span class="comment">/* 所有浏览器 */</span> </span><br><span class="line">    <span class="attribute">property</span>: value\<span class="number">9</span>;   <span class="comment">/* 所有IE浏览器 */</span> </span><br><span class="line">    <span class="attribute">property</span>: value\<span class="number">0</span>;   <span class="comment">/* IE8 */</span></span><br><span class="line">    +property: value;    /* IE7 */</span><br><span class="line">    _<span class="selector-tag">property</span>: <span class="selector-tag">value</span>;    <span class="comment">/* IE6 */</span></span><br><span class="line">    *<span class="selector-tag">property</span>: <span class="selector-tag">value</span>;    <span class="comment">/* IE6-7 */</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>当使用hack的时候想想能不能用更好的样式代替</p>
<h2 id="（不推荐）ie使用filter-（-禁止）使用expression"><a href="#（不推荐）ie使用filter-（-禁止）使用expression" class="headerlink" title="（不推荐）ie使用filter,（ 禁止）使用expression"></a>（不推荐）ie使用filter,（ 禁止）使用expression</h2><p>这里主要是效率问题，应该当格外注意，咱们要少用烧CPU的东西~ </p>
<h2 id="禁止）使用行内（inline）样式"><a href="#禁止）使用行内（inline）样式" class="headerlink" title="(禁止）使用行内（inline）样式"></a>(禁止）使用行内（inline）样式</h2><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">p</span> <span class="attr">style</span>=<span class="string">"font-size: 12px; color: #FFFFFF"</span>&gt;</span>靖鸣君<span class="tag">&lt;/<span class="name">p</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>像这样的行内样式，最好用一个class代替。又如要隐藏某个元素，可以给他加一个class</p>
<p>.hide {<br>    display: none;<br>}<br>尽量做到样式和结构分离~</p>
<h2 id="（推荐）reset-css样式"><a href="#（推荐）reset-css样式" class="headerlink" title="（推荐）reset.css样式"></a>（推荐）reset.css样式</h2><p>推荐网站：<a href="http://www.cssreset.com/" target="_blank" rel="noopener">http://www.cssreset.com/</a></p>
<h2 id="（禁止）使用”-”来选择元素"><a href="#（禁止）使用”-”来选择元素" class="headerlink" title="（禁止）使用”*”来选择元素"></a>（禁止）使用”*”来选择元素</h2><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*别这样写*/</span></span><br><span class="line">* &#123;</span><br><span class="line">    <span class="attribute">margin</span>: <span class="number">0</span>;</span><br><span class="line">    <span class="attribute">padding</span>: <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这样写是没有必要的，一些元素在浏览器中默认有margin或padding值，但是只是部分元素，没有必要将所有元素的margin、padding值都置为0。</p>
<p>链接的样式，（务必）按照这个顺序来书写<br><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">a</span><span class="selector-pseudo">:link</span> <span class="selector-tag">-</span>&gt; <span class="selector-tag">a</span><span class="selector-pseudo">:visited</span> <span class="selector-tag">-</span>&gt; <span class="selector-tag">a</span><span class="selector-pseudo">:hover</span> <span class="selector-tag">-</span>&gt; <span class="selector-tag">a</span><span class="selector-pseudo">:active</span></span><br></pre></td></tr></table></figure></p>
<p><a href="http://www.cnblogs.com/hustskyking/p/css-spec.html" target="_blank" rel="noopener">原文地址</a></p>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls"
                data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
            <ul id="audio-list" style="display:none">
                
                
                <li title='0' data-url='/statics/chengdu.mp3'></li>
                
                    
            </ul>
            
            
            
    <div id='gitalk-container' class="comment link"
        data-ae='true'
        data-ci='ec894e2b66f752e8b7fb'
        data-cs='3ccc2e92bb350688fe2c2dc2930189b62622bfb1'
        data-r='blog-comments'
        data-o='TriDiamond'
        data-a='TriDiamond'
        data-d='undefined'
    >Comments</div>


            
            
        </div>
        <div class="sidebar">
            <div class="box animated fadeInRight">
                <div class="subbox">
                    <img src="https://res.cloudinary.com/tridiamond/image/upload/v1573019751/TriDiamond_logo_ui_xeublz.jpg" height=300 width=300></img>
                    <p>张白告丶</p>
                    <span>Think like an artist, develop like an artisan</span>
                    <dl>
                        <dd><a href="https://github.com/zhanghao-web" target="_blank"><span
                                    class=" iconfont icon-github"></span></a></dd>
                        <dd><a href="" target="_blank"><span
                                    class=" iconfont icon-twitter"></span></a></dd>
                        <dd><a href="" target="_blank"><span
                                    class=" iconfont icon-stack-overflow"></span></a></dd>
                    </dl>
                </div>
                <ul>
                    <li><a href="/">149 <p>Articles</p></a></li>
                    <li><a href="/categories">23 <p>Categories</p></a></li>
                    <li><a href="/tags">47 <p>Tags</p></a></li>
                </ul>
            </div>
            
            
            
            <div class="box sticky animated fadeInRight faster">
                <div id="toc" class="subbox">
                    <h4>Contents</h4>
                    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#tab键用（必须）四个空格代替"><span class="toc-number">1.</span> <span class="toc-text">tab键用（必须）四个空格代替</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#每个样式属性后（必须）加-“-”"><span class="toc-number">2.</span> <span class="toc-text">每个样式属性后（必须）加 “;”</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Class命名中（禁止）出现大写字母，（必须）采用”-“对class中的字母分隔，如："><span class="toc-number">3.</span> <span class="toc-text">Class命名中（禁止）出现大写字母，（必须）采用” - “对class中的字母分隔，如：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#多选择器规则之间（必须）换行"><span class="toc-number">4.</span> <span class="toc-text">多选择器规则之间（必须）换行</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（禁止）将样式写为单行-如"><span class="toc-number">5.</span> <span class="toc-text">（禁止）将样式写为单行, 如</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（禁止）向-0-后添加单位-如："><span class="toc-number">6.</span> <span class="toc-text">（禁止）向 0 后添加单位, 如：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（禁止）使用css原生import"><span class="toc-number">7.</span> <span class="toc-text">（禁止）使用css原生import</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（推荐）属性的书写顺序-举个例子"><span class="toc-number">8.</span> <span class="toc-text">（推荐）属性的书写顺序, 举个例子:</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#小图片（必须）sprite-合并"><span class="toc-number">9.</span> <span class="toc-text">小图片（必须）sprite 合并</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#推荐）当编写针对特定html结构的样式时，使用元素名-类名"><span class="toc-number">10.</span> <span class="toc-text">(推荐）当编写针对特定html结构的样式时，使用元素名 + 类名</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#推荐）IE-Hack-List"><span class="toc-number">11.</span> <span class="toc-text">(推荐）IE Hack List</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（不推荐）ie使用filter-（-禁止）使用expression"><span class="toc-number">12.</span> <span class="toc-text">（不推荐）ie使用filter,（ 禁止）使用expression</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#禁止）使用行内（inline）样式"><span class="toc-number">13.</span> <span class="toc-text">(禁止）使用行内（inline）样式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（推荐）reset-css样式"><span class="toc-number">14.</span> <span class="toc-text">（推荐）reset.css样式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#（禁止）使用”-”来选择元素"><span class="toc-number">15.</span> <span class="toc-text">（禁止）使用”*”来选择元素</span></a></li></ol>
                </div>
            </div>
            
            
        </div>
    </div>
</div>

    </div>
</div>
    <div id="back-to-top" class="animated fadeIn faster">
        <div class="flow"></div>
        <span class="percentage animated fadeIn faster">0%</span>
        <span class="iconfont icon-top02 animated fadeIn faster"></span>
    </div>
</body>
<footer>
    <p class="copyright" id="copyright">
        &copy; 2020
        <span class="gradient-text">
            张白告丶
        </span>.
        Powered by <a href="http://hexo.io/" title="Hexo" target="_blank" rel="noopener">Hexo</a>
        Theme
        <span class="gradient-text">
            <a href="https://github.com/TriDiamond/hexo-theme-obsidian" title="Obsidian" target="_blank" rel="noopener">Obsidian</a>
        </span>
        <small><a href="https://github.com/TriDiamond/hexo-theme-obsidian/blob/master/CHANGELOG.md" title="v1.4.3" target="_blank" rel="noopener">v1.4.3</a></small>
    </p>
</footer>

<script type="text/javascript" src="https://cdn.bootcss.com/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script>
  MathJax.Hub.Config({
    "HTML-CSS": {
      preferredFont: "TeX",
      availableFonts: ["STIX", "TeX"],
      linebreaks: {
        automatic: true
      },
      EqnChunk: (MathJax.Hub.Browser.isMobile ? 10 : 50)
    },
    tex2jax: {
      inlineMath: [
        ["$", "$"],
        ["\\(", "\\)"]
      ],
      processEscapes: true,
      ignoreClass: "tex2jax_ignore|dno",
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
      noUndefined: {
        attributes: {
          mathcolor: "red",
          mathbackground: "#FFEEEE",
          mathsize: "90%"
        }
      },
      Macros: {
        href: "{}"
      }
    },
    messageStyle: "none"
  });
</script>
<script>
  function initialMathJax() {
    MathJax.Hub.Queue(function () {
      var all = MathJax.Hub.getAllJax(),
        i;
      // console.log(all);
      for (i = 0; i < all.length; i += 1) {
        console.log(all[i].SourceElement().parentNode)
        all[i].SourceElement().parentNode.className += ' has-jax';
      }
    });
  }

  function reprocessMathJax() {
    if (typeof MathJax !== 'undefined') {
      MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
    }
  }
</script>



    
<link rel="stylesheet" href="//cdn.bootcss.com/gitalk/1.5.0/gitalk.min.css">

    
<script src="//cdn.bootcss.com/gitalk/1.5.0/gitalk.min.js"></script>



<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/obsidian.js"></script>
<script src="/js/jquery.truncate.js"></script>
<script src="/js/search.js"></script>


<script src="//cdn.bootcss.com/typed.js/2.0.10/typed.min.js"></script>


<script src="//cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script>


<script src="//cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js"></script>


<script src="https://cdn.bootcss.com/codemirror/5.48.4/codemirror.min.js"></script>

    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/javascript/javascript.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/css/css.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/xml/xml.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/htmlmixed/htmlmixed.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/clike/clike.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/php/php.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/shell/shell.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/python/python.min.js"></script>




    
<script src="/js/busuanzi.min.js"></script>

    <script>
        $(document).ready(function () {
            if ($('span[id^="busuanzi_"]').length) {
                initialBusuanzi();
            }
        });
    </script>



<link rel="stylesheet" href="//cdn.bootcss.com/photoswipe/4.1.3/photoswipe.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/photoswipe/4.1.3/default-skin/default-skin.min.css">


<script src="//cdn.bootcss.com/photoswipe/4.1.3/photoswipe.min.js"></script>
<script src="//cdn.bootcss.com/photoswipe/4.1.3/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>



    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="//www.googletagmanager.com/gtag/js?id=UA-149874671-1"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());

        gtag('config', 'UA-149874671-1');
    </script>





<script>
    function initialTyped () {
        var typedTextEl = $('.typed-text');
        if (typedTextEl && typedTextEl.length > 0) {
            var typed = new Typed('.typed-text', {
                strings: ["Think like an artist, develop like an artisan", "艺术家思维去思考问题，工匠创造精神去开发"],
                typeSpeed: 90,
                loop: true,
                loopCount: Infinity,
                backSpeed: 20,
            });
        }
    }

    if ($('.article-header') && $('.article-header').length) {
        $(document).ready(function () {
            initialTyped();
        });
    }
</script>




</html>
